import request from '@/utils/request'

// 查询卡券列表
export function listCoupons(query) {
  return request({
    url: '/activitys/coupons/list',
    method: 'get',
    params: query
  })
}

// 查询卡券详细
export function getCoupons(id) {
  return request({
    url: '/activitys/coupons/' + id,
    method: 'get'
  })
}

// 新增卡券
export function addCoupons(data) {
  return request({
    url: '/activitys/coupons',
    method: 'post',
    data: data
  })
}

// 修改卡券
export function updateCoupons(data) {
  return request({
    url: '/activitys/coupons',
    method: 'put',
    data: data
  })
}

// 删除卡券
export function delCoupons(id) {
  return request({
    url: '/activitys/coupons/' + id,
    method: 'delete'
  })
}

// 查询所有卡券的支付方式
export function findAllCouponsPayType() {
  return request({
    url: '/activitys/coupons/findAllCouponsPayType',
    method: 'get'
  })
}

// 查询所有核销类型
export function findAllWriteOffType() {
  return request({
    url: '/activitys/coupons/findAllWriteOffType',
    method: 'get'
  })
}

// 查询所有卡券类型
export function findAllCouponsType() {
  return request({
    url: '/activitys/coupons/findAllCouponsType',
    method: 'get'
  })
}

// 根据代理商ID查询所有卡券
export function findCouponsByAgentId(platformAgentId) {
  return request({
    url: `/activitys/coupons/findCouponsByAgentId/${platformAgentId}  `,
    method: 'get'
  })
}
